import request from "@/utils/request";

//采购订单列表分页查询
export const getProcureList = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/page",
    method: "post",
    data: props
  });
};

//删除订单
export const delOrder = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/delOrder",
    method: "post",
    data: props
  });
};
//接单
export const acceptOrder = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/acceptOrder",
    method: "post",
    data: props
  });
};
//拒绝订单
export const refuseOrder = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/refuseOrder",
    method: "post",
    data: props
  });
};
//查询采购单详情
export const getDetail = props => {
  return request({
    url: `/mall/tenant/factory/purchase/order/getDetail/${props.purchaseOrderId}`,
    method: "post"
  });
};
//查询物流列表
export const packageDetailApi = props => {
  return request({
    url: `/mall/tenant/factory/purchase/order/packageDetail/${props.purchaseOrderId}`,
    method: "get"
  });
};
//查询打印、采购清单
export const detailedList = props => {
  return request({
    url: `/mall/tenant/factory/purchase/order/send/detailed/list/${props.purchaseOrderId}`,
    method: "get"
  });
};
//查询发货清单
export const sendList = props => {
  return request({
    url: `/mall/tenant/factory/purchase/order/send/detail/${props.purchaseOrderId}`,
    method: "get"
  });
};
//快递公司查询
export const selectCompanyPage = props => {
  return request({
    url: "/mall/kuaidi100/selectCompanyPage",
    method: "post",
    data: props
  });
};
//发货
export const sendApi = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/send",
    method: "post",
    data: props
  });
};
//修改物流的时候，查询包裹详情
export const packageInfo = props => {
  return request({
    url: `/mall/tenant/factory/purchase/order/packageInfo/${props.packageId}`,
    method: "get"
  });
};
//确认修改物流
export const modifyLogistics = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/modifyLogistics",
    method: "post",
    data: props
  });
};
//查看物流详情
export const findOrder = props => {
  return request({
    url: "/mall/kuaidi100/findOrder",
    method: "get",
    params: props
  });
};
//打印 分页查询
export const printList = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/send/print/page",
    method: "post",
    data: props
  });
};
//审核撤销订单
export const approvalCancel = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/approvalCancel",
    method: "post",
    data: props
  });
};

//发起生产完成确认
export const confirmProduceFinish = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/confirmProduceFinish",
    method: "post",
    data: props
  });
};

//发起安装完成确认
export const confirmInstallFinish = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/confirmInstallFinish",
    method: "post",
    data: props
  });
};

//自提货确认
export const confirmSelfPickup = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/confirmSelfPickup",
    method: "post",
    data: props
  });
};

//发起配送完成确认
export const confirmDistributeFinish = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/confirmDistributeFinish",
    method: "post",
    data: props
  });
};

//获取确认消息-type  1-生产、2-配送、3-自提货、4-安装确认
export const getConfirmMsg = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/getConfirmMsg",
    method: "post",
    data: props
  });
};

//保存发票文件
export const saveInvoiceFile = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/saveInvoiceFile",
    method: "post",
    data: props
  });
};

//获取预计发货日期
export const getExpectedDeliveryTime = props => {
  return request({
    url: "/mall/tenant/factory/purchase/order/getExpectedDeliveryTime",
    method: "post",
    data: props
  });
};

//工厂端自动配置保存
export const saveConfig = props => {
  return request({
    url: "/mall/tenant/factory/info/saveConfig",
    method: "post",
    data: props
  });
};

//获取工厂端自动配置
export const getConfig = props => {
  return request({
    url: `/mall/tenant/factory/info/config/${props.factoryId}`,
    method: "get"
  });
};
